package org.eyeTopLight.po.userEntity;

import lombok.Data;
import org.eyeTopLight.utilities.SharedUtilities;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

@Data
public class User implements UserDetails {
    private Integer user_id;
    private String user_name;
    private String user_nickName;
    private String user_phone;
    private String user_password;
    private String user_authorities;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return SharedUtilities.getInstance().convertStringToList(this.user_authorities);
    }

    @Override
    public String getPassword() {
        return user_password;
    }

    @Override
    public String getUsername() {
        return user_name;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }

}
